package com.tedu.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.tedu.dao.DoorMapper;
import com.tedu.pojo.Door;

/**
 * 测试springmvc的运行环境
 * 测试SSM的运行环境
 */
@Controller
public class TestController {
	@Autowired
	DoorMapper dao;
	/* @Autowired（自动装配）注解其实就是将当期对象
	 * 的创建交给spring容器, 由spring容器为DoorMapper
	 * 接口提供实现类, 并通过实现类创建对象, 再将对象赋
	 * 值给dao变量。
	 */
	
	//1.测试springmvc的运行环境
	@RequestMapping("/testmvc")
	public String testmvc() {
		System.out.println("testmvc.....");
		return "test";
	}
	
	//2.测试ssm的运行环境
	@RequestMapping("/testssm")
	public String testssm() {
		System.out.println( "------------"+dao );
		//查询所有门店信息
		List<Door> list = dao.findAll();
		for (Door door : list) {
			System.out.println( door );
		}
		System.out.println("ssm整合成功....");
		
		return "test";
	}
}










